package br.com.skolar.client.framework;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;

public class Event extends GwtEvent<Event.Handler> {
	public interface Handler<E extends Event> extends EventHandler {
		void onEvent(E e);
	}
	static final Type TYPE = new Type();
	
	public final ParamCommand callbackCommand;
	
	public Event() { 
		this(null);
	}
	
	public Event(ParamCommand callbackCommand) { 
		this.callbackCommand = callbackCommand;
	}
	
	@Override
	public final Type getAssociatedType() {
		return TYPE;
	}

	@Override
	protected final void dispatch(Event.Handler handler) {
		handler.onEvent(this);
	}
}